package fresher.java.finaltest.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectDB {
	private static Connection conn = null;
	private static final String DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
	private static final String URL = "jdbc:sqlserver://localhost:1433;databaseName=FinalTest2";

	public static Connection getConnect() {
		try {
			Class.forName(DRIVER);
			conn = DriverManager.getConnection(URL, "sa", "123");

		} catch (ClassNotFoundException e) {
			System.out.println("Thieu Driver!");
			//e.printStackTrace();

		} catch (SQLException e) {
			System.out.println("Xem Lai Server!");
			//e.printStackTrace();
		}
		return conn;
	}

}
